package com.victor.dao;

import java.util.HashMap;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.victor.entity.city.CityCenterLocation;
import com.victor.entity.collection.JqCollection;
import com.victor.entity.jingqu.Jingdianintroduce;
import com.victor.entity.jingqu.Jingdiantupian;
import com.victor.entity.jingqu.Jingquclass;
import com.victor.entity.jingqu.Jingqujingdian;
import com.victor.entity.jingqu.Jingqulist;
import com.victor.entity.jingqu.JingquticketIntroduce;
import com.victor.entity.jingqu.Jingqutupian;
import com.victor.entity.praise.JqcommentPraise;


@Mapper
public interface JingquDao {

	/**
	 * 获取所有景区类别
	 */
	@Select({ "select * from jingquclass order by id desc" })
	List<Jingquclass> getClassList();

	/**
	 * 添加景区类型
	 */
	@Insert({ "insert into jingquclass (jqclassname,jqphoto) values (#{jqclassname},#{jqphoto})" })
	int addClass(Jingquclass jingquclass);

	/**
	 * 修改类别信息
	 */
	int updateClass(Jingquclass jingquclass);

	/**
	 * 批量删除类别
	 */
	int deleteClass(@Param("ids") int[] ids);

	/**
	 * 获取景区列表
	 * 
	 * @param jqclass
	 * @param starttime
	 * @param endtime
	 * @param searchname
	 * @return
	 */
	List<Jingqulist> getJQlist(@Param("jqclassid") String jqclassid, @Param("starttime") String starttime,
			@Param("endtime") String endtime, @Param("searchname") String searchname);

	/**
	 * 新建景区--添加景区信息
	 * 
	 * @param jingqulist
	 * @return
	 */
	int buildJQ(Jingqulist jingqulist);

	/**
	 * 添加景区图片信息
	 * 
	 * @param jingqutupian
	 * @return
	 */
	@Insert({ "insert into jingqutupian (jqphoto,jqid) values (#{jqphoto},#{jqid})" })
	int addJingqutupian(Jingqutupian jingqutupian);

	/**
	 * 批量删除
	 * 
	 * @param jqids
	 * @return
	 */
	int batchDeleteJQ(@Param("jqids") int[] jqids);

	/**
	 * 景区详情
	 * 
	 * @param jqid
	 * @return
	 */
	Jingqulist getJQxqByid(@Param("jqid") String jqid);

	/**
	 * 修改景区信息
	 * 
	 * @param jingqulist
	 * @return
	 */
	int updateJQ(Jingqulist jingqulist);

	/**
	 * 添加景点
	 * 
	 * @param jingqujingdian
	 * @return
	 */
	int addJingdian(Jingqujingdian jingqujingdian);

	/**
	 * 添加景点图片
	 * 
	 * @param jingdiantupian
	 * @return
	 */
	@Insert({ "insert into jingdiantupian (jdphoto,jdid) values (#{jdphoto},#{jdid}) " })
	int addJingdiantupian(Jingdiantupian jingdiantupian);

	/**
	 * 删除景点
	 * 
	 * @param jdid
	 * @return
	 */
	int deleteJingdianByid(@Param("jdid") String jdid);

	/**
	 * 添加景点简介
	 * 
	 * @param jingdianintroduce
	 * @return
	 */
	@Insert({ "insert into jingdianintroduce (jdintroduce,jdid) values (#{jdintroduce},#{jdid})" })
	int addJdintroduce(Jingdianintroduce jingdianintroduce);

	/**
	 * 修改景点
	 * 
	 * @param jingqujingdian
	 * @return
	 */
	boolean updateJD(Jingqujingdian jingqujingdian);

	/**
	 * 删除景点原图片
	 * 
	 * @param jdid
	 * @return
	 */
	@Delete({ "delete from jingdiantupian where jdid=#{jdid}" })
	int deleteJingdianTup(@Param("jdid") Integer jdid);

	/**
	 * 删除景点原简介
	 * 
	 * @param jdid
	 * @return
	 */
	@Delete({ "delete from jingdianintroduce where jdid=#{jdid}" })
	int deleteJingdianJJ(@Param("jdid") Integer jdid);
	/**
	 * 景区图片根据id查询
	 * @param id
	 * @return
	 */
	@Select({"select * from jingqutupian where id=#{id}"})
	List<Jingqutupian> selJingqutupianById(Integer id);
	/**
	 * 删除景区
	 * @param id
	 * @return
	 */
    int deleteByPrimaryKey(int[] id);
    /**
     * 景区详情（没登陆）
     * @param id
     * @return
     */
    Jingqulist selectByPrimaryKey(String id);
    /**
     * 查询全部
     * @return
     */
    @Select({"select * from jingqulist"})
	List<Jingqulist> selAll();
    /**
     * 根据省，市，搜索条件查询
     * @param map
     * @return
     */
	List<Jingqulist> selByCondition(HashMap<Object, Object> map);
	/**
	 * 景区详情（登陆）
	 * @param jqid
	 * @param uid
	 * @return
	 */
	Jingqulist selectByPrimaryKeyAndUid(@Param("jqid")String jqid,@Param("uid") String uid);
	/**
	 * 首页景区列表
	 * @param city
	 * @param classid
	 * @param level
	 * @param area 
	 * @param search 
	 * @param location
	 * @param screening
	 * @return
	 */
	List<Jingqulist> selList(@Param("city")String city,@Param("classid") String classid,@Param("level") String level,@Param("area") String area,@Param("search") String search);
	/**
	 * 根据城市查询
	 * @param city
	 * @return
	 */
	@Select({"select * from jingqulist where city=#{city}"})
	List<Jingqulist> selByCity(String city);
	/**
	 * 查询全国多有城市
	 * @param city
	 * @return
	 */
	@Select({"select * from city_center_location where cityname=#{city}"})
	CityCenterLocation selCityCenLocation(String city);
	/**
	 * 查询筛选
	 * @param screening
	 * @return
	 */
	List<Jingqulist> selShaiXuan(String screening,String city);
	/**
	 * 查询票须知
	 * @param id
	 * @return
	 */
	JingquticketIntroduce selTicketIntroduceByTid(String id);
	

}
